package com.jinit.rpc.provider.service;

import com.jinit.rpc.api.pojo.Order;
import com.jinit.rpc.api.service.OrderService;
import com.jinit.rpc.provider.annotation.RpcService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 订单服务实现
 *
 * @author JInit
 * @date 2021-08-29
 */
@Service
@RpcService
public class OrderServiceImpl implements OrderService {

    Map<Integer, Order> orderMap = new HashMap<>();

    @Override
    public Order getOrderById(int id) {
        if (orderMap.isEmpty()) {
            orderMap.put(1, new Order(1, "订单01"));
            orderMap.put(2, new Order(2, "订单02"));
        }
        return orderMap.get(id);
    }
}
